package org.orbis.search;

import org.orbis.communicate.FlagsResult;

public class SearchResult{
	private long internalID;
	private int resultIndex;
	private double score;
	private String[] content;
	private String[] appendix;
	private boolean[] binaryFlags;
	private int[] intFlags;
	private long[] longFlags;
	private float[] floatFlags;

	private SearchResult(){}

	public static SearchResult makeResult(long internalID, double score, String[] content, String[] appendix){
		SearchResult result = new SearchResult();
		result.internalID = internalID;
		result.score = score;
		result.content = content;
		result.appendix = appendix;
		return result;
	}

	public SearchResult setScore(double score){
		this.score = score;
		return this;
	}

	public long internalID(){
		return internalID;
	}

	public double score(){
		return score;
	}

	public void setIndex(int index){
		this.resultIndex = index;
	}

	public int index(){
		return resultIndex;
	}

	public int contentSize(){
		return content.length;
	}

	public String content(int index){
		return content[index];
	}

	public int appendixSize(){
		return appendix.length;
	}

	public String appendix(int index){
		return appendix[index];
	}

	public void setFlags(FlagsResult flags){
		this.binaryFlags = flags.binaryFlags();
		this.intFlags = flags.intFlags();
		this.longFlags = flags.longFlags();
		this.floatFlags = flags.floatFlags();
	}

	public boolean[] binaryFlags(){
		return binaryFlags;
	}

	public int[] intFlags(){
		return intFlags;
	}

	public long[] longFlags(){
		return longFlags;
	}

	public float[] floatFlags(){
		return floatFlags;
	}
}
